# name : Delete/remove All User-defined Macro Variables
# key : delete.all.user.macrovars
# contributor: Shuguang Sun
# --
%macro delvars;
  data vars;
    set sashelp.vmacro;
  run;

  data _null_;
    set vars;
    temp=lag(name);
    if scope='GLOBAL' and substr(name, 1, 3) ne 'SYS' and temp ne name then
      call execute('%symdel '|| trim(left(name)) || ';');
  run;

%mend delvars;

%delvars